/**
 * 
 */
package com.thor.palmmall.rest.position;

import org.springframework.beans.factory.annotation.Autowired;

import com.thor.commons.exception.ThorServiceException;
import com.thor.palmmall.rest.position.converter.APositionConverter;
import com.thor.palmmall.rest.position.converter.SPositionParamConverter;
import com.thor.palmmall.spi.common.SResponse;
import com.thor.palmmall.spi.position.SPosition;
import com.thor.palmmall.spi.position.SPositionService;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class APositionServiceImpl implements APositionService {
  @Autowired
  private SPositionService spositionService;

  @Override
  public APosition positionInfo(APositionParam param) throws ThorServiceException {
    SResponse<SPosition> resp = spositionService
        .positionInfo(SPositionParamConverter.getInstance().convert(param));
    if (resp.isSuccess())
      return APositionConverter.getInstance().convert(resp.getBody());
    else
      throw new ThorServiceException("无法根据项目获取位置信息：" + resp.getMessage());
  }

}
